package tsing.kc_work.cology.intention;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @Date 2024/8/1 9:59
 * @Author Tsing
 * 调接口的工具类
 */
public class CallInterfaceUtil {

    private static String testPrefixUrl = "http://172.16.60.28:8000/vipway/";

    public static void main(String[] args) {
        getCallUrl();
    }
    public static String getRequestParam(){
        String secret = "mUMI4IAOTTH6eeAG";

        SupplierIntentionDomain bean = SupplierIntentionDomain.builder()
                .intentionId("878412151")
                .intentionalSection("1")
                .email("230@qq.com")
                .contactPhoneNumber("1517")
                .contactName("czw")
                .enterpriseName("KC")
                .businessLicense("/a.pdf")
                .unifiedSocialCreditCode("PT95278")
                .customerDemand("用户意见")
                .operateTime(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"))
                .build();
        String result =null;
        try {
            result = AESBase64Util.encrypt(JSON.toJSONString(bean),secret);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        Map<String, String> map = new HashMap<>(1);
        map.put("intentionObject",result);
        return JSON.toJSONString(map);
    }

    public static String getCallUrl(){
        String url = "http://172.16.60.28:8000/vipway/receive/syncIntention";
//        String url = "http://localhost:8033/syncIntention";
        String data  = getRequestParam();
        System.out.println("curl -H 'Content-Type:application/json' -X POST -i  '"+ url + "'  --data '" + data + "' -vv");
//        String response = HttpUtil.post(url, data);
        return null;
    }

}
